<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>退款</title>
		<meta name="keywords" content="知果汇" />
		<meta name="description" content="知果汇" />
		<link rel="SHORTCUT ICON" href="_IMG_/favicon.ico" />
		<link rel="stylesheet" type="text/css" href="_CSS_/reset.css">
		<link rel="stylesheet" type="text/css" href="_CSS_/common.css">
		<link rel="stylesheet" type="text/css" href="_CSS_/store_center.css"/>
		<style type="text/css">
		    html,body{width: 570px;min-width: 570px;}
			form{width: 540px;padding: 20px;}
			.formItem{overflow: hidden;}
			.formItem label{font-size: 14px;color: #333333;}
			.products{overflow: hidden;width: 470px;}
			.products img{width: 120px;height: 120px;float: left;}
			.products p{width: 340px;display: inline-block;float: left;padding-left: 10px;margin-bottom: 15px;}
			.productName{font-size: 14px;color: #333333;}
			.greyTag{color: #999999;font-size: 12px;width: 70px;display: inline-block;}
			.types,.mode{font-size: 11px;color: #333333;}
			.priceNum{font-size: 14px;color: #FF4900;}
			.fillin{border: 1px solid #E5E5E5;height: 34px;line-height:34px;font-size: 14px;color: #999999;width: 428px;padding: 0 10px;}
			.commentsFill{font-size: 14px;text-indent: 0;}
			.btn-box{width: 570px;text-align: center;margin-top: 20px;}
			.btn-box a {display: inline-block;height: 37px;line-height: 37px;margin: 5px 25px 0;padding: 0 30px;border: 1px solid #dedede;background-color: #fff;color: #333;border-radius: 5px;font-weight: 400;cursor: pointer;text-decoration: none;font-size: 14px;}
			.btn-box .btn-n1{border-color: #3377c0;background-color: #3377c0;color: #ffffff;}
			.con-p{font-size: 16px;color: #333333;}
			.con-pl{font-size: 14px;}
		</style>
	</head>
	<body>
		<form action="" method="post">
			<div class="formItem">
				<div class="products fl" name="products">
					<img src="" alt=""/>
					<p class="productName"></p>
					<p class="prices priceNum"><span class="greyTag">价格</span><span class="priceNum"></span></p>
					<p class="mode"><span class="greyTag">类型</span><span class="serviceType">服务类商品</span></p>
					<p class="types"><span class="greyTag">服务分类</span><span class="productType"></span></p>
				</div>
			</div>
			<p class="con-p">确认退款吗？</p>
			<div class="btn-box">
               	   <a class="btn-n1" href="javascript:;" title="确认" onclick="confirm()">确认</a>
				<a class="btn-n1" href="javascript:;" title="拒绝" onclick="refuse()">拒绝</a>
               	   <a class="btn-n2" href="javascript:;" title="取消" onclick="cancel()">取消</a>
            </div>
		</form>
	</body>
	<script src="_JS_/jquery-1.8.3.min.js"></script>
	<script src="_JS_/jquery.base64.js"></script>
	<script src="_JS_/jquery.cookie.js"></script>
	<script src="_JS_/common.js"></script>
	<script src="_P_/layer/layer.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			var url = window.location.href;
			var id = url.split("#")[1];
			$.ajax({
				type: "get",
				url: "/index.php/api/form/order_details",
				data: {
					'id': id,
					'type': 2
				},
				dataType: 'jsonp',
				success: function (msg) {
					if (msg.code == 200) {
						$('.products').attr('num',msg.data.id);
						$('.productName').html(msg.data.username);
						$('.products').find('img').attr('src','/Images/serviceGoods/'+msg.data.image);
						var price_num = number_format(msg.data.store, 2, ".", ",");
						$('.prices').html('￥'+price_num+'起');
						$('.productType').html(msg.data.trading_name);
					}
					if (msg.code == 1000) {
						layer.msg('查询失败！', {icon: 5});
					}
				}
			});

		});
		//确认
		function confirm(obj){
			var id=$('.products').attr('num');
			if(!id){
				layer.msg('网络错误！', {icon: 5});
				return false;
			}
			var userinfo=$.cookie('userinfo');
			if(userinfo) {
				var user_login = $.base64.decode(userinfo).split(",");
				var user_uid = user_login[0];
			}else{
				layer.msg('还未登录！', {icon: 5});
				return false;
			}
			$.ajax({
				type: "get",
				url: "/index.php/api/account/confirm_refund",
				data: {
					'id': id,
					'uid': user_uid,
					'status':1
				},
				dataType: 'jsonp',
				beforeSend: function () {
                var index = layer.load(1, {
                    shade: [0.1, '#333333'] //0.1透明度的白色背景
                });
				},
				success: function (msg) {
					layer.closeAll();
					if (msg.code == 200) {
				
						parent.order_service(1);
						var desk = parent.layer.getFrameIndex(window.name);
								parent.layer.close(desk);
					}
					if (msg.code == 1000) {
						layer.msg('查询失败！', {icon: 5});
					}
				}
			});

		}
		//拒绝
		function refuse(obj){
			var id=$('.products').attr('num');

				layer.prompt({title: '拒绝原因', formType: 2}, function (text, index) {
					layer.close(index);
					var userinfo=$.cookie('userinfo');
					if(userinfo) {
						var user_login = $.base64.decode(userinfo).split(",");
						var uid = user_login[0];
						//相关数据操作
						$.ajax({
							type: "get",
							url: "/index.php/api/account/confirm_refund",
							data: {'id': id,'status':2,'result':text},
							dataType: 'jsonp',
							beforeSend: function () {
							var index = layer.load(1, {
								shade: [0.1, '#333333'] //0.1透明度的白色背景
							});
							},
							success: function (msg) {
								layer.closeAll();
								if (msg.code == 200) {	
									parent.order_service(1);								
									var desk = parent.layer.getFrameIndex(window.name);								
									parent.layer.close(desk);
								}
								if (msg.code == 1000) {
									layer.msg('失败！', {icon: 51});
								}
							}
						});
					}else{
						layer.msg('还未登录！', {icon: 51});
					}

				});

		}

		//取消
		function cancel(obj){
            var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}
	</script>
</html>
